﻿@model Auction_Intranet.Models.AddCreditModel

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm("AddCredit", "Groups", FormMethod.Post, new { @class = "add-credit-group-form black-shadow-box" }))
{   
        <legend>Add credit to @Model.groupName</legend>
        <div class="create-group-form-errors form-validation-display">   
             @Html.ValidationSummary(true)
             @Html.ValidationMessageFor(model => model.creditAdded)
         </div>
        <div class="hide editor-field">
            @Html.EditorFor(model => model.userId)
        </div>
        <div class="hide editor-field">
            @Html.EditorFor(model => model.groupId)
        </div>
        <div class="hide editor-field">
            @Html.EditorFor(model => model.groupName)
        </div>
        <div class="hide editor-field available-credit">
            @Html.EditorFor(model => model.userCredit)
        </div>
        <div class="amounts">
            <div class="editor-label">
                <p>@Html.LabelFor(model => model.creditAdded)</p>
                <p>Available: <span class="available-balance ">@Model.userCredit</span></p>
            </div>
            <div class="editor-field spinner">                
                @Html.TextBoxFor(model => model.creditAdded, new { @class = "spinner-add-credit", autocomplete = "off", placeholder = "amount" })
            </div>
        </div>
        <div class="hide editor-field">
            @Html.EditorFor(model => model.creditSpent)
        </div>
        <div class="hide editor-field">
            @Html.EditorFor(model => model.ActiveMember)
        </div>
        <div class="add-credit-group-form-button">
            <input class="input-button" type="submit" value="Add" title="Add Credit"/> <!--<input class="input-button" type="button" value="Cancel" onclick="goBack()" />-->
            <input class="input-button" type="button" value="Cancel" title="Cancel" onclick="javascript:document.location.href='@Url.Action("Index", "Groups")'">
        </div>
}

<script type="text/javascript">
    $(function () {
        $(".spinner-add-credit").spinner({
            max: $(".available-credit input").val(),
            min: 1
        });
    });
</script>